/**
 * Copyright (c) 2013-2022, Alibaba Group Holding Limited;
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * </p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: TxnStream.proto

package com.aliyun.polardbx.binlog.protocol;

/**
 * Protobuf type {@code com.aliyun.polardbx.binlog.protocol.TxnToken}
 */
public final class TxnToken extends
    com.google.protobuf.GeneratedMessageV3 implements
    // @@protoc_insertion_point(message_implements:com.aliyun.polardbx.binlog.protocol.TxnToken)
    TxnTokenOrBuilder {
private static final long serialVersionUID = 0L;
  // Use TxnToken.newBuilder() to construct.
  private TxnToken(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
    super(builder);
  }
  private TxnToken() {
    tso_ = "";
    partitionId_ = "";
    originMergeSourceId_ = "";
    type_ = 0;
    schema_ = "";
    allParties_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    payload_ = com.google.protobuf.ByteString.EMPTY;
    table_ = "";
    ddl_ = "";
  }

  @java.lang.Override
  @SuppressWarnings({"unused"})
  protected java.lang.Object newInstance(
      UnusedPrivateParameter unused) {
    return new TxnToken();
  }

  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
  getUnknownFields() {
    return this.unknownFields;
  }
  private TxnToken(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    this();
    if (extensionRegistry == null) {
      throw new java.lang.NullPointerException();
    }
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          case 10: {
            java.lang.String s = input.readStringRequireUtf8();

            tso_ = s;
            break;
          }
          case 16: {

            txnId_ = input.readInt64();
            break;
          }
          case 26: {
            java.lang.String s = input.readStringRequireUtf8();

            partitionId_ = s;
            break;
          }
          case 34: {
            java.lang.String s = input.readStringRequireUtf8();

            originMergeSourceId_ = s;
            break;
          }
          case 40: {
            int rawValue = input.readEnum();

            type_ = rawValue;
            break;
          }
          case 48: {

            xaTxn_ = input.readBool();
            break;
          }
          case 56: {

            tsoTransaction_ = input.readBool();
            break;
          }
          case 64: {

            txnSize_ = input.readInt32();
            break;
          }
          case 74: {
            java.lang.String s = input.readStringRequireUtf8();

            schema_ = s;
            break;
          }
          case 82: {
            java.lang.String s = input.readStringRequireUtf8();
            if (!((mutable_bitField0_ & 0x00000001) != 0)) {
              allParties_ = new com.google.protobuf.LazyStringArrayList();
              mutable_bitField0_ |= 0x00000001;
            }
            allParties_.add(s);
            break;
          }
          case 90: {

            payload_ = input.readBytes();
            break;
          }
          case 96: {

            snapshotSeq_ = input.readInt64();
            break;
          }
          case 106: {
            java.lang.String s = input.readStringRequireUtf8();

            table_ = s;
            break;
          }
          case 114: {
            com.google.protobuf.Int64Value.Builder subBuilder = null;
            if (serverId_ != null) {
              subBuilder = serverId_.toBuilder();
            }
            serverId_ = input.readMessage(com.google.protobuf.Int64Value.parser(), extensionRegistry);
            if (subBuilder != null) {
              subBuilder.mergeFrom(serverId_);
              serverId_ = subBuilder.buildPartial();
            }

            break;
          }
          case 122: {
            java.lang.String s = input.readStringRequireUtf8();

            ddl_ = s;
            break;
          }
          default: {
            if (!parseUnknownField(
                input, unknownFields, extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000001) != 0)) {
        allParties_ = allParties_.getUnmodifiableView();
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnToken_descriptor;
  }

  @java.lang.Override
  protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnToken_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.aliyun.polardbx.binlog.protocol.TxnToken.class, com.aliyun.polardbx.binlog.protocol.TxnToken.Builder.class);
  }

  public static final int TSO_FIELD_NUMBER = 1;
  private volatile java.lang.Object tso_;
  /**
   * <code>string tso = 1;</code>
   * @return The tso.
   */
  @java.lang.Override
  public java.lang.String getTso() {
    java.lang.Object ref = tso_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      tso_ = s;
      return s;
    }
  }
  /**
   * <code>string tso = 1;</code>
   * @return The bytes for tso.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getTsoBytes() {
    java.lang.Object ref = tso_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      tso_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int TXNID_FIELD_NUMBER = 2;
  private long txnId_;
  /**
   * <code>int64 txnId = 2;</code>
   * @return The txnId.
   */
  @java.lang.Override
  public long getTxnId() {
    return txnId_;
  }

  public static final int PARTITIONID_FIELD_NUMBER = 3;
  private volatile java.lang.Object partitionId_;
  /**
   * <code>string partitionId = 3;</code>
   * @return The partitionId.
   */
  @java.lang.Override
  public java.lang.String getPartitionId() {
    java.lang.Object ref = partitionId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      partitionId_ = s;
      return s;
    }
  }
  /**
   * <code>string partitionId = 3;</code>
   * @return The bytes for partitionId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getPartitionIdBytes() {
    java.lang.Object ref = partitionId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      partitionId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int ORIGINMERGESOURCEID_FIELD_NUMBER = 4;
  private volatile java.lang.Object originMergeSourceId_;
  /**
   * <code>string originMergeSourceId = 4;</code>
   * @return The originMergeSourceId.
   */
  @java.lang.Override
  public java.lang.String getOriginMergeSourceId() {
    java.lang.Object ref = originMergeSourceId_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      originMergeSourceId_ = s;
      return s;
    }
  }
  /**
   * <code>string originMergeSourceId = 4;</code>
   * @return The bytes for originMergeSourceId.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getOriginMergeSourceIdBytes() {
    java.lang.Object ref = originMergeSourceId_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      originMergeSourceId_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int TYPE_FIELD_NUMBER = 5;
  private int type_;
  /**
   * <code>.com.aliyun.polardbx.binlog.protocol.TxnType type = 5;</code>
   * @return The enum numeric value on the wire for type.
   */
  @java.lang.Override public int getTypeValue() {
    return type_;
  }
  /**
   * <code>.com.aliyun.polardbx.binlog.protocol.TxnType type = 5;</code>
   * @return The type.
   */
  @java.lang.Override public com.aliyun.polardbx.binlog.protocol.TxnType getType() {
    @SuppressWarnings("deprecation")
    com.aliyun.polardbx.binlog.protocol.TxnType result = com.aliyun.polardbx.binlog.protocol.TxnType.valueOf(type_);
    return result == null ? com.aliyun.polardbx.binlog.protocol.TxnType.UNRECOGNIZED : result;
  }

  public static final int XATXN_FIELD_NUMBER = 6;
  private boolean xaTxn_;
  /**
   * <code>bool xaTxn = 6;</code>
   * @return The xaTxn.
   */
  @java.lang.Override
  public boolean getXaTxn() {
    return xaTxn_;
  }

  public static final int TSOTRANSACTION_FIELD_NUMBER = 7;
  private boolean tsoTransaction_;
  /**
   * <pre>
   **
   *标识是否为Tso事务。虽然【Tso事务】和【NoTso事务】的Token都有tso字段，
   *但是【NoTso事务】的tso是根据其前序【Tso事务】的真实tso生成的虚拟tso
   * </pre>
   *
   * <code>bool tsoTransaction = 7;</code>
   * @return The tsoTransaction.
   */
  @java.lang.Override
  public boolean getTsoTransaction() {
    return tsoTransaction_;
  }

  public static final int TXNSIZE_FIELD_NUMBER = 8;
  private int txnSize_;
  /**
   * <pre>
   **
   *该事务下的所有LogEvent的个数，注意：不是某个批次的的个数
   * </pre>
   *
   * <code>int32 txnSize = 8;</code>
   * @return The txnSize.
   */
  @java.lang.Override
  public int getTxnSize() {
    return txnSize_;
  }

  public static final int SCHEMA_FIELD_NUMBER = 9;
  private volatile java.lang.Object schema_;
  /**
   * <pre>
   **
   *1.dumper生成事务的begin头时使用
   *2.ddl场景下标识ddl sql对应的库名
   * </pre>
   *
   * <code>string schema = 9;</code>
   * @return The schema.
   */
  @java.lang.Override
  public java.lang.String getSchema() {
    java.lang.Object ref = schema_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      schema_ = s;
      return s;
    }
  }
  /**
   * <pre>
   **
   *1.dumper生成事务的begin头时使用
   *2.ddl场景下标识ddl sql对应的库名
   * </pre>
   *
   * <code>string schema = 9;</code>
   * @return The bytes for schema.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getSchemaBytes() {
    java.lang.Object ref = schema_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      schema_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int ALLPARTIES_FIELD_NUMBER = 10;
  private com.google.protobuf.LazyStringList allParties_;
  /**
   * <pre>
   **
   *该事务的所有参与者
   * </pre>
   *
   * <code>repeated string allParties = 10;</code>
   * @return A list containing the allParties.
   */
  public com.google.protobuf.ProtocolStringList
      getAllPartiesList() {
    return allParties_;
  }
  /**
   * <pre>
   **
   *该事务的所有参与者
   * </pre>
   *
   * <code>repeated string allParties = 10;</code>
   * @return The count of allParties.
   */
  public int getAllPartiesCount() {
    return allParties_.size();
  }
  /**
   * <pre>
   **
   *该事务的所有参与者
   * </pre>
   *
   * <code>repeated string allParties = 10;</code>
   * @param index The index of the element to return.
   * @return The allParties at the given index.
   */
  public java.lang.String getAllParties(int index) {
    return allParties_.get(index);
  }
  /**
   * <pre>
   **
   *该事务的所有参与者
   * </pre>
   *
   * <code>repeated string allParties = 10;</code>
   * @param index The index of the value to return.
   * @return The bytes of the allParties at the given index.
   */
  public com.google.protobuf.ByteString
      getAllPartiesBytes(int index) {
    return allParties_.getByteString(index);
  }

  public static final int PAYLOAD_FIELD_NUMBER = 11;
  private com.google.protobuf.ByteString payload_;
  /**
   * <pre>
   **
   *一些特殊的TxnToken，没有TxnItem的概念，此时通过payload字段传输数据
   * </pre>
   *
   * <code>bytes payload = 11;</code>
   * @return The payload.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString getPayload() {
    return payload_;
  }

  public static final int SNAPSHOTSEQ_FIELD_NUMBER = 12;
  private long snapshotSeq_;
  /**
   * <pre>
   **
   *Tso事务专用
   * </pre>
   *
   * <code>int64 snapshotSeq = 12;</code>
   * @return The snapshotSeq.
   */
  @java.lang.Override
  public long getSnapshotSeq() {
    return snapshotSeq_;
  }

  public static final int TABLE_FIELD_NUMBER = 13;
  private volatile java.lang.Object table_;
  /**
   * <pre>
   **
   *表名，非必须
   * </pre>
   *
   * <code>string table = 13;</code>
   * @return The table.
   */
  @java.lang.Override
  public java.lang.String getTable() {
    java.lang.Object ref = table_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      table_ = s;
      return s;
    }
  }
  /**
   * <pre>
   **
   *表名，非必须
   * </pre>
   *
   * <code>string table = 13;</code>
   * @return The bytes for table.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getTableBytes() {
    java.lang.Object ref = table_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      table_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  public static final int SERVERID_FIELD_NUMBER = 14;
  private com.google.protobuf.Int64Value serverId_;
  /**
   * <pre>
   **
   *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
   * </pre>
   *
   * <code>.google.protobuf.Int64Value serverId = 14;</code>
   * @return Whether the serverId field is set.
   */
  @java.lang.Override
  public boolean hasServerId() {
    return serverId_ != null;
  }
  /**
   * <pre>
   **
   *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
   * </pre>
   *
   * <code>.google.protobuf.Int64Value serverId = 14;</code>
   * @return The serverId.
   */
  @java.lang.Override
  public com.google.protobuf.Int64Value getServerId() {
    return serverId_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : serverId_;
  }
  /**
   * <pre>
   **
   *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
   * </pre>
   *
   * <code>.google.protobuf.Int64Value serverId = 14;</code>
   */
  @java.lang.Override
  public com.google.protobuf.Int64ValueOrBuilder getServerIdOrBuilder() {
    return getServerId();
  }

  public static final int DDL_FIELD_NUMBER = 15;
  private volatile java.lang.Object ddl_;
  /**
   * <code>string ddl = 15;</code>
   * @return The ddl.
   */
  @java.lang.Override
  public java.lang.String getDdl() {
    java.lang.Object ref = ddl_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      ddl_ = s;
      return s;
    }
  }
  /**
   * <code>string ddl = 15;</code>
   * @return The bytes for ddl.
   */
  @java.lang.Override
  public com.google.protobuf.ByteString
      getDdlBytes() {
    java.lang.Object ref = ddl_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      ddl_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  private byte memoizedIsInitialized = -1;
  @java.lang.Override
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized == 1) return true;
    if (isInitialized == 0) return false;

    memoizedIsInitialized = 1;
    return true;
  }

  @java.lang.Override
  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    if (!getTsoBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 1, tso_);
    }
    if (txnId_ != 0L) {
      output.writeInt64(2, txnId_);
    }
    if (!getPartitionIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 3, partitionId_);
    }
    if (!getOriginMergeSourceIdBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 4, originMergeSourceId_);
    }
    if (type_ != com.aliyun.polardbx.binlog.protocol.TxnType.DML.getNumber()) {
      output.writeEnum(5, type_);
    }
    if (xaTxn_ != false) {
      output.writeBool(6, xaTxn_);
    }
    if (tsoTransaction_ != false) {
      output.writeBool(7, tsoTransaction_);
    }
    if (txnSize_ != 0) {
      output.writeInt32(8, txnSize_);
    }
    if (!getSchemaBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 9, schema_);
    }
    for (int i = 0; i < allParties_.size(); i++) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 10, allParties_.getRaw(i));
    }
    if (!payload_.isEmpty()) {
      output.writeBytes(11, payload_);
    }
    if (snapshotSeq_ != 0L) {
      output.writeInt64(12, snapshotSeq_);
    }
    if (!getTableBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 13, table_);
    }
    if (serverId_ != null) {
      output.writeMessage(14, getServerId());
    }
    if (!getDdlBytes().isEmpty()) {
      com.google.protobuf.GeneratedMessageV3.writeString(output, 15, ddl_);
    }
    unknownFields.writeTo(output);
  }

  @java.lang.Override
  public int getSerializedSize() {
    int size = memoizedSize;
    if (size != -1) return size;

    size = 0;
    if (!getTsoBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, tso_);
    }
    if (txnId_ != 0L) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt64Size(2, txnId_);
    }
    if (!getPartitionIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, partitionId_);
    }
    if (!getOriginMergeSourceIdBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, originMergeSourceId_);
    }
    if (type_ != com.aliyun.polardbx.binlog.protocol.TxnType.DML.getNumber()) {
      size += com.google.protobuf.CodedOutputStream
        .computeEnumSize(5, type_);
    }
    if (xaTxn_ != false) {
      size += com.google.protobuf.CodedOutputStream
        .computeBoolSize(6, xaTxn_);
    }
    if (tsoTransaction_ != false) {
      size += com.google.protobuf.CodedOutputStream
        .computeBoolSize(7, tsoTransaction_);
    }
    if (txnSize_ != 0) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt32Size(8, txnSize_);
    }
    if (!getSchemaBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, schema_);
    }
    {
      int dataSize = 0;
      for (int i = 0; i < allParties_.size(); i++) {
        dataSize += computeStringSizeNoTag(allParties_.getRaw(i));
      }
      size += dataSize;
      size += 1 * getAllPartiesList().size();
    }
    if (!payload_.isEmpty()) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(11, payload_);
    }
    if (snapshotSeq_ != 0L) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt64Size(12, snapshotSeq_);
    }
    if (!getTableBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(13, table_);
    }
    if (serverId_ != null) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(14, getServerId());
    }
    if (!getDdlBytes().isEmpty()) {
      size += com.google.protobuf.GeneratedMessageV3.computeStringSize(15, ddl_);
    }
    size += unknownFields.getSerializedSize();
    memoizedSize = size;
    return size;
  }

  @java.lang.Override
  public boolean equals(final java.lang.Object obj) {
    if (obj == this) {
     return true;
    }
    if (!(obj instanceof com.aliyun.polardbx.binlog.protocol.TxnToken)) {
      return super.equals(obj);
    }
    com.aliyun.polardbx.binlog.protocol.TxnToken other = (com.aliyun.polardbx.binlog.protocol.TxnToken) obj;

    if (!getTso()
        .equals(other.getTso())) return false;
    if (getTxnId()
        != other.getTxnId()) return false;
    if (!getPartitionId()
        .equals(other.getPartitionId())) return false;
    if (!getOriginMergeSourceId()
        .equals(other.getOriginMergeSourceId())) return false;
    if (type_ != other.type_) return false;
    if (getXaTxn()
        != other.getXaTxn()) return false;
    if (getTsoTransaction()
        != other.getTsoTransaction()) return false;
    if (getTxnSize()
        != other.getTxnSize()) return false;
    if (!getSchema()
        .equals(other.getSchema())) return false;
    if (!getAllPartiesList()
        .equals(other.getAllPartiesList())) return false;
    if (!getPayload()
        .equals(other.getPayload())) return false;
    if (getSnapshotSeq()
        != other.getSnapshotSeq()) return false;
    if (!getTable()
        .equals(other.getTable())) return false;
    if (hasServerId() != other.hasServerId()) return false;
    if (hasServerId()) {
      if (!getServerId()
          .equals(other.getServerId())) return false;
    }
    if (!getDdl()
        .equals(other.getDdl())) return false;
    if (!unknownFields.equals(other.unknownFields)) return false;
    return true;
  }

  @java.lang.Override
  public int hashCode() {
    if (memoizedHashCode != 0) {
      return memoizedHashCode;
    }
    int hash = 41;
    hash = (19 * hash) + getDescriptor().hashCode();
    hash = (37 * hash) + TSO_FIELD_NUMBER;
    hash = (53 * hash) + getTso().hashCode();
    hash = (37 * hash) + TXNID_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
        getTxnId());
    hash = (37 * hash) + PARTITIONID_FIELD_NUMBER;
    hash = (53 * hash) + getPartitionId().hashCode();
    hash = (37 * hash) + ORIGINMERGESOURCEID_FIELD_NUMBER;
    hash = (53 * hash) + getOriginMergeSourceId().hashCode();
    hash = (37 * hash) + TYPE_FIELD_NUMBER;
    hash = (53 * hash) + type_;
    hash = (37 * hash) + XATXN_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
        getXaTxn());
    hash = (37 * hash) + TSOTRANSACTION_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(
        getTsoTransaction());
    hash = (37 * hash) + TXNSIZE_FIELD_NUMBER;
    hash = (53 * hash) + getTxnSize();
    hash = (37 * hash) + SCHEMA_FIELD_NUMBER;
    hash = (53 * hash) + getSchema().hashCode();
    if (getAllPartiesCount() > 0) {
      hash = (37 * hash) + ALLPARTIES_FIELD_NUMBER;
      hash = (53 * hash) + getAllPartiesList().hashCode();
    }
    hash = (37 * hash) + PAYLOAD_FIELD_NUMBER;
    hash = (53 * hash) + getPayload().hashCode();
    hash = (37 * hash) + SNAPSHOTSEQ_FIELD_NUMBER;
    hash = (53 * hash) + com.google.protobuf.Internal.hashLong(
        getSnapshotSeq());
    hash = (37 * hash) + TABLE_FIELD_NUMBER;
    hash = (53 * hash) + getTable().hashCode();
    if (hasServerId()) {
      hash = (37 * hash) + SERVERID_FIELD_NUMBER;
      hash = (53 * hash) + getServerId().hashCode();
    }
    hash = (37 * hash) + DDL_FIELD_NUMBER;
    hash = (53 * hash) + getDdl().hashCode();
    hash = (29 * hash) + unknownFields.hashCode();
    memoizedHashCode = hash;
    return hash;
  }

  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      java.nio.ByteBuffer data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      java.nio.ByteBuffer data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseDelimitedWithIOException(PARSER, input, extensionRegistry);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input);
  }
  public static com.aliyun.polardbx.binlog.protocol.TxnToken parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return com.google.protobuf.GeneratedMessageV3
        .parseWithIOException(PARSER, input, extensionRegistry);
  }

  @java.lang.Override
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder() {
    return DEFAULT_INSTANCE.toBuilder();
  }
  public static Builder newBuilder(com.aliyun.polardbx.binlog.protocol.TxnToken prototype) {
    return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
  }
  @java.lang.Override
  public Builder toBuilder() {
    return this == DEFAULT_INSTANCE
        ? new Builder() : new Builder().mergeFrom(this);
  }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code com.aliyun.polardbx.binlog.protocol.TxnToken}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
      // @@protoc_insertion_point(builder_implements:com.aliyun.polardbx.binlog.protocol.TxnToken)
      com.aliyun.polardbx.binlog.protocol.TxnTokenOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnToken_descriptor;
    }

    @java.lang.Override
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnToken_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.aliyun.polardbx.binlog.protocol.TxnToken.class, com.aliyun.polardbx.binlog.protocol.TxnToken.Builder.class);
    }

    // Construct using com.aliyun.polardbx.binlog.protocol.TxnToken.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessageV3
              .alwaysUseFieldBuilders) {
      }
    }
    @java.lang.Override
    public Builder clear() {
      super.clear();
      tso_ = "";

      txnId_ = 0L;

      partitionId_ = "";

      originMergeSourceId_ = "";

      type_ = 0;

      xaTxn_ = false;

      tsoTransaction_ = false;

      txnSize_ = 0;

      schema_ = "";

      allParties_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000001);
      payload_ = com.google.protobuf.ByteString.EMPTY;

      snapshotSeq_ = 0L;

      table_ = "";

      if (serverIdBuilder_ == null) {
        serverId_ = null;
      } else {
        serverId_ = null;
        serverIdBuilder_ = null;
      }
      ddl_ = "";

      return this;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.aliyun.polardbx.binlog.protocol.TxnStream.internal_static_com_aliyun_polardbx_binlog_protocol_TxnToken_descriptor;
    }

    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnToken getDefaultInstanceForType() {
      return com.aliyun.polardbx.binlog.protocol.TxnToken.getDefaultInstance();
    }

    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnToken build() {
      com.aliyun.polardbx.binlog.protocol.TxnToken result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnToken buildPartial() {
      com.aliyun.polardbx.binlog.protocol.TxnToken result = new com.aliyun.polardbx.binlog.protocol.TxnToken(this);
      int from_bitField0_ = bitField0_;
      result.tso_ = tso_;
      result.txnId_ = txnId_;
      result.partitionId_ = partitionId_;
      result.originMergeSourceId_ = originMergeSourceId_;
      result.type_ = type_;
      result.xaTxn_ = xaTxn_;
      result.tsoTransaction_ = tsoTransaction_;
      result.txnSize_ = txnSize_;
      result.schema_ = schema_;
      if (((bitField0_ & 0x00000001) != 0)) {
        allParties_ = allParties_.getUnmodifiableView();
        bitField0_ = (bitField0_ & ~0x00000001);
      }
      result.allParties_ = allParties_;
      result.payload_ = payload_;
      result.snapshotSeq_ = snapshotSeq_;
      result.table_ = table_;
      if (serverIdBuilder_ == null) {
        result.serverId_ = serverId_;
      } else {
        result.serverId_ = serverIdBuilder_.build();
      }
      result.ddl_ = ddl_;
      onBuilt();
      return result;
    }

    @java.lang.Override
    public Builder clone() {
      return super.clone();
    }
    @java.lang.Override
    public Builder setField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.setField(field, value);
    }
    @java.lang.Override
    public Builder clearField(
        com.google.protobuf.Descriptors.FieldDescriptor field) {
      return super.clearField(field);
    }
    @java.lang.Override
    public Builder clearOneof(
        com.google.protobuf.Descriptors.OneofDescriptor oneof) {
      return super.clearOneof(oneof);
    }
    @java.lang.Override
    public Builder setRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        int index, java.lang.Object value) {
      return super.setRepeatedField(field, index, value);
    }
    @java.lang.Override
    public Builder addRepeatedField(
        com.google.protobuf.Descriptors.FieldDescriptor field,
        java.lang.Object value) {
      return super.addRepeatedField(field, value);
    }
    @java.lang.Override
    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.aliyun.polardbx.binlog.protocol.TxnToken) {
        return mergeFrom((com.aliyun.polardbx.binlog.protocol.TxnToken)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.aliyun.polardbx.binlog.protocol.TxnToken other) {
      if (other == com.aliyun.polardbx.binlog.protocol.TxnToken.getDefaultInstance()) return this;
      if (!other.getTso().isEmpty()) {
        tso_ = other.tso_;
        onChanged();
      }
      if (other.getTxnId() != 0L) {
        setTxnId(other.getTxnId());
      }
      if (!other.getPartitionId().isEmpty()) {
        partitionId_ = other.partitionId_;
        onChanged();
      }
      if (!other.getOriginMergeSourceId().isEmpty()) {
        originMergeSourceId_ = other.originMergeSourceId_;
        onChanged();
      }
      if (other.type_ != 0) {
        setTypeValue(other.getTypeValue());
      }
      if (other.getXaTxn() != false) {
        setXaTxn(other.getXaTxn());
      }
      if (other.getTsoTransaction() != false) {
        setTsoTransaction(other.getTsoTransaction());
      }
      if (other.getTxnSize() != 0) {
        setTxnSize(other.getTxnSize());
      }
      if (!other.getSchema().isEmpty()) {
        schema_ = other.schema_;
        onChanged();
      }
      if (!other.allParties_.isEmpty()) {
        if (allParties_.isEmpty()) {
          allParties_ = other.allParties_;
          bitField0_ = (bitField0_ & ~0x00000001);
        } else {
          ensureAllPartiesIsMutable();
          allParties_.addAll(other.allParties_);
        }
        onChanged();
      }
      if (other.getPayload() != com.google.protobuf.ByteString.EMPTY) {
        setPayload(other.getPayload());
      }
      if (other.getSnapshotSeq() != 0L) {
        setSnapshotSeq(other.getSnapshotSeq());
      }
      if (!other.getTable().isEmpty()) {
        table_ = other.table_;
        onChanged();
      }
      if (other.hasServerId()) {
        mergeServerId(other.getServerId());
      }
      if (!other.getDdl().isEmpty()) {
        ddl_ = other.ddl_;
        onChanged();
      }
      this.mergeUnknownFields(other.unknownFields);
      onChanged();
      return this;
    }

    @java.lang.Override
    public final boolean isInitialized() {
      return true;
    }

    @java.lang.Override
    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.aliyun.polardbx.binlog.protocol.TxnToken parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.aliyun.polardbx.binlog.protocol.TxnToken) e.getUnfinishedMessage();
        throw e.unwrapIOException();
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    private java.lang.Object tso_ = "";
    /**
     * <code>string tso = 1;</code>
     * @return The tso.
     */
    public java.lang.String getTso() {
      java.lang.Object ref = tso_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        tso_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <code>string tso = 1;</code>
     * @return The bytes for tso.
     */
    public com.google.protobuf.ByteString
        getTsoBytes() {
      java.lang.Object ref = tso_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        tso_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>string tso = 1;</code>
     * @param value The tso to set.
     * @return This builder for chaining.
     */
    public Builder setTso(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      tso_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>string tso = 1;</code>
     * @return This builder for chaining.
     */
    public Builder clearTso() {
      
      tso_ = getDefaultInstance().getTso();
      onChanged();
      return this;
    }
    /**
     * <code>string tso = 1;</code>
     * @param value The bytes for tso to set.
     * @return This builder for chaining.
     */
    public Builder setTsoBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      tso_ = value;
      onChanged();
      return this;
    }

    private long txnId_ ;
    /**
     * <code>int64 txnId = 2;</code>
     * @return The txnId.
     */
    @java.lang.Override
    public long getTxnId() {
      return txnId_;
    }
    /**
     * <code>int64 txnId = 2;</code>
     * @param value The txnId to set.
     * @return This builder for chaining.
     */
    public Builder setTxnId(long value) {
      
      txnId_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>int64 txnId = 2;</code>
     * @return This builder for chaining.
     */
    public Builder clearTxnId() {
      
      txnId_ = 0L;
      onChanged();
      return this;
    }

    private java.lang.Object partitionId_ = "";
    /**
     * <code>string partitionId = 3;</code>
     * @return The partitionId.
     */
    public java.lang.String getPartitionId() {
      java.lang.Object ref = partitionId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        partitionId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <code>string partitionId = 3;</code>
     * @return The bytes for partitionId.
     */
    public com.google.protobuf.ByteString
        getPartitionIdBytes() {
      java.lang.Object ref = partitionId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        partitionId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>string partitionId = 3;</code>
     * @param value The partitionId to set.
     * @return This builder for chaining.
     */
    public Builder setPartitionId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      partitionId_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>string partitionId = 3;</code>
     * @return This builder for chaining.
     */
    public Builder clearPartitionId() {
      
      partitionId_ = getDefaultInstance().getPartitionId();
      onChanged();
      return this;
    }
    /**
     * <code>string partitionId = 3;</code>
     * @param value The bytes for partitionId to set.
     * @return This builder for chaining.
     */
    public Builder setPartitionIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      partitionId_ = value;
      onChanged();
      return this;
    }

    private java.lang.Object originMergeSourceId_ = "";
    /**
     * <code>string originMergeSourceId = 4;</code>
     * @return The originMergeSourceId.
     */
    public java.lang.String getOriginMergeSourceId() {
      java.lang.Object ref = originMergeSourceId_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        originMergeSourceId_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <code>string originMergeSourceId = 4;</code>
     * @return The bytes for originMergeSourceId.
     */
    public com.google.protobuf.ByteString
        getOriginMergeSourceIdBytes() {
      java.lang.Object ref = originMergeSourceId_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        originMergeSourceId_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>string originMergeSourceId = 4;</code>
     * @param value The originMergeSourceId to set.
     * @return This builder for chaining.
     */
    public Builder setOriginMergeSourceId(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      originMergeSourceId_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>string originMergeSourceId = 4;</code>
     * @return This builder for chaining.
     */
    public Builder clearOriginMergeSourceId() {
      
      originMergeSourceId_ = getDefaultInstance().getOriginMergeSourceId();
      onChanged();
      return this;
    }
    /**
     * <code>string originMergeSourceId = 4;</code>
     * @param value The bytes for originMergeSourceId to set.
     * @return This builder for chaining.
     */
    public Builder setOriginMergeSourceIdBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      originMergeSourceId_ = value;
      onChanged();
      return this;
    }

    private int type_ = 0;
    /**
     * <code>.com.aliyun.polardbx.binlog.protocol.TxnType type = 5;</code>
     * @return The enum numeric value on the wire for type.
     */
    @java.lang.Override public int getTypeValue() {
      return type_;
    }
    /**
     * <code>.com.aliyun.polardbx.binlog.protocol.TxnType type = 5;</code>
     * @param value The enum numeric value on the wire for type to set.
     * @return This builder for chaining.
     */
    public Builder setTypeValue(int value) {
      
      type_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>.com.aliyun.polardbx.binlog.protocol.TxnType type = 5;</code>
     * @return The type.
     */
    @java.lang.Override
    public com.aliyun.polardbx.binlog.protocol.TxnType getType() {
      @SuppressWarnings("deprecation")
      com.aliyun.polardbx.binlog.protocol.TxnType result = com.aliyun.polardbx.binlog.protocol.TxnType.valueOf(type_);
      return result == null ? com.aliyun.polardbx.binlog.protocol.TxnType.UNRECOGNIZED : result;
    }
    /**
     * <code>.com.aliyun.polardbx.binlog.protocol.TxnType type = 5;</code>
     * @param value The type to set.
     * @return This builder for chaining.
     */
    public Builder setType(com.aliyun.polardbx.binlog.protocol.TxnType value) {
      if (value == null) {
        throw new NullPointerException();
      }
      
      type_ = value.getNumber();
      onChanged();
      return this;
    }
    /**
     * <code>.com.aliyun.polardbx.binlog.protocol.TxnType type = 5;</code>
     * @return This builder for chaining.
     */
    public Builder clearType() {
      
      type_ = 0;
      onChanged();
      return this;
    }

    private boolean xaTxn_ ;
    /**
     * <code>bool xaTxn = 6;</code>
     * @return The xaTxn.
     */
    @java.lang.Override
    public boolean getXaTxn() {
      return xaTxn_;
    }
    /**
     * <code>bool xaTxn = 6;</code>
     * @param value The xaTxn to set.
     * @return This builder for chaining.
     */
    public Builder setXaTxn(boolean value) {
      
      xaTxn_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>bool xaTxn = 6;</code>
     * @return This builder for chaining.
     */
    public Builder clearXaTxn() {
      
      xaTxn_ = false;
      onChanged();
      return this;
    }

    private boolean tsoTransaction_ ;
    /**
     * <pre>
     **
     *标识是否为Tso事务。虽然【Tso事务】和【NoTso事务】的Token都有tso字段，
     *但是【NoTso事务】的tso是根据其前序【Tso事务】的真实tso生成的虚拟tso
     * </pre>
     *
     * <code>bool tsoTransaction = 7;</code>
     * @return The tsoTransaction.
     */
    @java.lang.Override
    public boolean getTsoTransaction() {
      return tsoTransaction_;
    }
    /**
     * <pre>
     **
     *标识是否为Tso事务。虽然【Tso事务】和【NoTso事务】的Token都有tso字段，
     *但是【NoTso事务】的tso是根据其前序【Tso事务】的真实tso生成的虚拟tso
     * </pre>
     *
     * <code>bool tsoTransaction = 7;</code>
     * @param value The tsoTransaction to set.
     * @return This builder for chaining.
     */
    public Builder setTsoTransaction(boolean value) {
      
      tsoTransaction_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *标识是否为Tso事务。虽然【Tso事务】和【NoTso事务】的Token都有tso字段，
     *但是【NoTso事务】的tso是根据其前序【Tso事务】的真实tso生成的虚拟tso
     * </pre>
     *
     * <code>bool tsoTransaction = 7;</code>
     * @return This builder for chaining.
     */
    public Builder clearTsoTransaction() {
      
      tsoTransaction_ = false;
      onChanged();
      return this;
    }

    private int txnSize_ ;
    /**
     * <pre>
     **
     *该事务下的所有LogEvent的个数，注意：不是某个批次的的个数
     * </pre>
     *
     * <code>int32 txnSize = 8;</code>
     * @return The txnSize.
     */
    @java.lang.Override
    public int getTxnSize() {
      return txnSize_;
    }
    /**
     * <pre>
     **
     *该事务下的所有LogEvent的个数，注意：不是某个批次的的个数
     * </pre>
     *
     * <code>int32 txnSize = 8;</code>
     * @param value The txnSize to set.
     * @return This builder for chaining.
     */
    public Builder setTxnSize(int value) {
      
      txnSize_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *该事务下的所有LogEvent的个数，注意：不是某个批次的的个数
     * </pre>
     *
     * <code>int32 txnSize = 8;</code>
     * @return This builder for chaining.
     */
    public Builder clearTxnSize() {
      
      txnSize_ = 0;
      onChanged();
      return this;
    }

    private java.lang.Object schema_ = "";
    /**
     * <pre>
     **
     *1.dumper生成事务的begin头时使用
     *2.ddl场景下标识ddl sql对应的库名
     * </pre>
     *
     * <code>string schema = 9;</code>
     * @return The schema.
     */
    public java.lang.String getSchema() {
      java.lang.Object ref = schema_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        schema_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     **
     *1.dumper生成事务的begin头时使用
     *2.ddl场景下标识ddl sql对应的库名
     * </pre>
     *
     * <code>string schema = 9;</code>
     * @return The bytes for schema.
     */
    public com.google.protobuf.ByteString
        getSchemaBytes() {
      java.lang.Object ref = schema_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        schema_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     **
     *1.dumper生成事务的begin头时使用
     *2.ddl场景下标识ddl sql对应的库名
     * </pre>
     *
     * <code>string schema = 9;</code>
     * @param value The schema to set.
     * @return This builder for chaining.
     */
    public Builder setSchema(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      schema_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.dumper生成事务的begin头时使用
     *2.ddl场景下标识ddl sql对应的库名
     * </pre>
     *
     * <code>string schema = 9;</code>
     * @return This builder for chaining.
     */
    public Builder clearSchema() {
      
      schema_ = getDefaultInstance().getSchema();
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *1.dumper生成事务的begin头时使用
     *2.ddl场景下标识ddl sql对应的库名
     * </pre>
     *
     * <code>string schema = 9;</code>
     * @param value The bytes for schema to set.
     * @return This builder for chaining.
     */
    public Builder setSchemaBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      schema_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.LazyStringList allParties_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    private void ensureAllPartiesIsMutable() {
      if (!((bitField0_ & 0x00000001) != 0)) {
        allParties_ = new com.google.protobuf.LazyStringArrayList(allParties_);
        bitField0_ |= 0x00000001;
       }
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @return A list containing the allParties.
     */
    public com.google.protobuf.ProtocolStringList
        getAllPartiesList() {
      return allParties_.getUnmodifiableView();
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @return The count of allParties.
     */
    public int getAllPartiesCount() {
      return allParties_.size();
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @param index The index of the element to return.
     * @return The allParties at the given index.
     */
    public java.lang.String getAllParties(int index) {
      return allParties_.get(index);
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @param index The index of the value to return.
     * @return The bytes of the allParties at the given index.
     */
    public com.google.protobuf.ByteString
        getAllPartiesBytes(int index) {
      return allParties_.getByteString(index);
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @param index The index to set the value at.
     * @param value The allParties to set.
     * @return This builder for chaining.
     */
    public Builder setAllParties(
        int index, java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  ensureAllPartiesIsMutable();
      allParties_.set(index, value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @param value The allParties to add.
     * @return This builder for chaining.
     */
    public Builder addAllParties(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  ensureAllPartiesIsMutable();
      allParties_.add(value);
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @param values The allParties to add.
     * @return This builder for chaining.
     */
    public Builder addAllAllParties(
        java.lang.Iterable<java.lang.String> values) {
      ensureAllPartiesIsMutable();
      com.google.protobuf.AbstractMessageLite.Builder.addAll(
          values, allParties_);
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @return This builder for chaining.
     */
    public Builder clearAllParties() {
      allParties_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000001);
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *该事务的所有参与者
     * </pre>
     *
     * <code>repeated string allParties = 10;</code>
     * @param value The bytes of the allParties to add.
     * @return This builder for chaining.
     */
    public Builder addAllPartiesBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      ensureAllPartiesIsMutable();
      allParties_.add(value);
      onChanged();
      return this;
    }

    private com.google.protobuf.ByteString payload_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <pre>
     **
     *一些特殊的TxnToken，没有TxnItem的概念，此时通过payload字段传输数据
     * </pre>
     *
     * <code>bytes payload = 11;</code>
     * @return The payload.
     */
    @java.lang.Override
    public com.google.protobuf.ByteString getPayload() {
      return payload_;
    }
    /**
     * <pre>
     **
     *一些特殊的TxnToken，没有TxnItem的概念，此时通过payload字段传输数据
     * </pre>
     *
     * <code>bytes payload = 11;</code>
     * @param value The payload to set.
     * @return This builder for chaining.
     */
    public Builder setPayload(com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      payload_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *一些特殊的TxnToken，没有TxnItem的概念，此时通过payload字段传输数据
     * </pre>
     *
     * <code>bytes payload = 11;</code>
     * @return This builder for chaining.
     */
    public Builder clearPayload() {
      
      payload_ = getDefaultInstance().getPayload();
      onChanged();
      return this;
    }

    private long snapshotSeq_ ;
    /**
     * <pre>
     **
     *Tso事务专用
     * </pre>
     *
     * <code>int64 snapshotSeq = 12;</code>
     * @return The snapshotSeq.
     */
    @java.lang.Override
    public long getSnapshotSeq() {
      return snapshotSeq_;
    }
    /**
     * <pre>
     **
     *Tso事务专用
     * </pre>
     *
     * <code>int64 snapshotSeq = 12;</code>
     * @param value The snapshotSeq to set.
     * @return This builder for chaining.
     */
    public Builder setSnapshotSeq(long value) {
      
      snapshotSeq_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *Tso事务专用
     * </pre>
     *
     * <code>int64 snapshotSeq = 12;</code>
     * @return This builder for chaining.
     */
    public Builder clearSnapshotSeq() {
      
      snapshotSeq_ = 0L;
      onChanged();
      return this;
    }

    private java.lang.Object table_ = "";
    /**
     * <pre>
     **
     *表名，非必须
     * </pre>
     *
     * <code>string table = 13;</code>
     * @return The table.
     */
    public java.lang.String getTable() {
      java.lang.Object ref = table_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        table_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <pre>
     **
     *表名，非必须
     * </pre>
     *
     * <code>string table = 13;</code>
     * @return The bytes for table.
     */
    public com.google.protobuf.ByteString
        getTableBytes() {
      java.lang.Object ref = table_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        table_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <pre>
     **
     *表名，非必须
     * </pre>
     *
     * <code>string table = 13;</code>
     * @param value The table to set.
     * @return This builder for chaining.
     */
    public Builder setTable(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      table_ = value;
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *表名，非必须
     * </pre>
     *
     * <code>string table = 13;</code>
     * @return This builder for chaining.
     */
    public Builder clearTable() {
      
      table_ = getDefaultInstance().getTable();
      onChanged();
      return this;
    }
    /**
     * <pre>
     **
     *表名，非必须
     * </pre>
     *
     * <code>string table = 13;</code>
     * @param value The bytes for table to set.
     * @return This builder for chaining.
     */
    public Builder setTableBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      table_ = value;
      onChanged();
      return this;
    }

    private com.google.protobuf.Int64Value serverId_;
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Int64Value, com.google.protobuf.Int64Value.Builder, com.google.protobuf.Int64ValueOrBuilder> serverIdBuilder_;
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     * @return Whether the serverId field is set.
     */
    public boolean hasServerId() {
      return serverIdBuilder_ != null || serverId_ != null;
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     * @return The serverId.
     */
    public com.google.protobuf.Int64Value getServerId() {
      if (serverIdBuilder_ == null) {
        return serverId_ == null ? com.google.protobuf.Int64Value.getDefaultInstance() : serverId_;
      } else {
        return serverIdBuilder_.getMessage();
      }
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     */
    public Builder setServerId(com.google.protobuf.Int64Value value) {
      if (serverIdBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        serverId_ = value;
        onChanged();
      } else {
        serverIdBuilder_.setMessage(value);
      }

      return this;
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     */
    public Builder setServerId(
        com.google.protobuf.Int64Value.Builder builderForValue) {
      if (serverIdBuilder_ == null) {
        serverId_ = builderForValue.build();
        onChanged();
      } else {
        serverIdBuilder_.setMessage(builderForValue.build());
      }

      return this;
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     */
    public Builder mergeServerId(com.google.protobuf.Int64Value value) {
      if (serverIdBuilder_ == null) {
        if (serverId_ != null) {
          serverId_ =
            com.google.protobuf.Int64Value.newBuilder(serverId_).mergeFrom(value).buildPartial();
        } else {
          serverId_ = value;
        }
        onChanged();
      } else {
        serverIdBuilder_.mergeFrom(value);
      }

      return this;
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     */
    public Builder clearServerId() {
      if (serverIdBuilder_ == null) {
        serverId_ = null;
        onChanged();
      } else {
        serverId_ = null;
        serverIdBuilder_ = null;
      }

      return this;
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     */
    public com.google.protobuf.Int64Value.Builder getServerIdBuilder() {
      
      onChanged();
      return getServerIdFieldBuilder().getBuilder();
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     */
    public com.google.protobuf.Int64ValueOrBuilder getServerIdOrBuilder() {
      if (serverIdBuilder_ != null) {
        return serverIdBuilder_.getMessageOrBuilder();
      } else {
        return serverId_ == null ?
            com.google.protobuf.Int64Value.getDefaultInstance() : serverId_;
      }
    }
    /**
     * <pre>
     **
     *使用Wrapper类型，解决兼容性问题，因为serverId可以设置为0
     * </pre>
     *
     * <code>.google.protobuf.Int64Value serverId = 14;</code>
     */
    private com.google.protobuf.SingleFieldBuilderV3<
        com.google.protobuf.Int64Value, com.google.protobuf.Int64Value.Builder, com.google.protobuf.Int64ValueOrBuilder> 
        getServerIdFieldBuilder() {
      if (serverIdBuilder_ == null) {
        serverIdBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
            com.google.protobuf.Int64Value, com.google.protobuf.Int64Value.Builder, com.google.protobuf.Int64ValueOrBuilder>(
                getServerId(),
                getParentForChildren(),
                isClean());
        serverId_ = null;
      }
      return serverIdBuilder_;
    }

    private java.lang.Object ddl_ = "";
    /**
     * <code>string ddl = 15;</code>
     * @return The ddl.
     */
    public java.lang.String getDdl() {
      java.lang.Object ref = ddl_;
      if (!(ref instanceof java.lang.String)) {
        com.google.protobuf.ByteString bs =
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        ddl_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <code>string ddl = 15;</code>
     * @return The bytes for ddl.
     */
    public com.google.protobuf.ByteString
        getDdlBytes() {
      java.lang.Object ref = ddl_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        ddl_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>string ddl = 15;</code>
     * @param value The ddl to set.
     * @return This builder for chaining.
     */
    public Builder setDdl(
        java.lang.String value) {
      if (value == null) {
    throw new NullPointerException();
  }
  
      ddl_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>string ddl = 15;</code>
     * @return This builder for chaining.
     */
    public Builder clearDdl() {
      
      ddl_ = getDefaultInstance().getDdl();
      onChanged();
      return this;
    }
    /**
     * <code>string ddl = 15;</code>
     * @param value The bytes for ddl to set.
     * @return This builder for chaining.
     */
    public Builder setDdlBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
      
      ddl_ = value;
      onChanged();
      return this;
    }
    @java.lang.Override
    public final Builder setUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.setUnknownFields(unknownFields);
    }

    @java.lang.Override
    public final Builder mergeUnknownFields(
        final com.google.protobuf.UnknownFieldSet unknownFields) {
      return super.mergeUnknownFields(unknownFields);
    }


    // @@protoc_insertion_point(builder_scope:com.aliyun.polardbx.binlog.protocol.TxnToken)
  }

  // @@protoc_insertion_point(class_scope:com.aliyun.polardbx.binlog.protocol.TxnToken)
  private static final com.aliyun.polardbx.binlog.protocol.TxnToken DEFAULT_INSTANCE;
  static {
    DEFAULT_INSTANCE = new com.aliyun.polardbx.binlog.protocol.TxnToken();
  }

  public static com.aliyun.polardbx.binlog.protocol.TxnToken getDefaultInstance() {
    return DEFAULT_INSTANCE;
  }

  private static final com.google.protobuf.Parser<TxnToken>
      PARSER = new com.google.protobuf.AbstractParser<TxnToken>() {
    @java.lang.Override
    public TxnToken parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new TxnToken(input, extensionRegistry);
    }
  };

  public static com.google.protobuf.Parser<TxnToken> parser() {
    return PARSER;
  }

  @java.lang.Override
  public com.google.protobuf.Parser<TxnToken> getParserForType() {
    return PARSER;
  }

  @java.lang.Override
  public com.aliyun.polardbx.binlog.protocol.TxnToken getDefaultInstanceForType() {
    return DEFAULT_INSTANCE;
  }

}

